﻿using UnityEngine;
using DG.Tweening;
using System;

namespace HKTools
{
    /// <summary>
    /// 提示标签控制脚本
    /// </summary>
    public class HK_TipTitle : MonoBehaviour
    {
        // 标签的点击事件回调
        public Action OnClickCallback;

        Vector3 initScale;
        bool isMouseIn;

        void Start()
        {
            initScale = transform.localScale;
        }

        void OnMouseEnter()
        {
            transform.DOScale(initScale * 1.15f, 0.3f);
            isMouseIn = true;
        }

        void OnMouseExit()
        {
            transform.DOScale(initScale, 0.3f);
            isMouseIn = false;
        }

        void OnMouseUp()
        {
            if (isMouseIn)
            {
                OnClickCallback?.Invoke();

                transform.DOShakeScale(0.25f, 0.2f, 10, 90, true);
            }
        }
    }
}